// reducer 是一个函数，负责根据 action 的类型和 payload 返回相应的 state
export default function counter(state = 10, action) {
  switch (action.type) {
    case 'INCREMENT':
      return state + action.payload
    case 'DECREMENT':
      return state - action.payload
    default:
      return state
  }
}
